import axios from "axios";

/**
 * 创建api公共访问路径
 * @type {axios.AxiosInstance}
 */
const httpInstance2=axios.create({
    //baseURL: "http://192.168.1.245:8081",
     baseURL: `${import.meta.env.VITE_APP_API_BASE_URL}/files`,
    //baseURL: `${import.meta.env.VITE_APP_API_BASE_URL}/files`,
    timeout: 500000,
})

/**
 *
 * axios 响应拦截器
 */
httpInstance2.interceptors.response.use(
    response => response.data,
    error => {
        console.log(error)
        return Promise.reject(error);
    }

)
/**
 * axios 请求拦截器
 */
httpInstance2.interceptors.request.use(
    config => {
        return config;
    },e=> {
        console.log(e)
        return Promise.reject(e);
    }
)

export default httpInstance2;